<!-- <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>

<body>


    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
            try {
                axios.get('https://mock.mengxuegu.com/mock/63e3130a4b99657e298502f2/trycatch/quaqnxiandeom').then((res)=>{
                    console.log(res.data.data.message)
                    alert(res.data.data.message)
                    console.log('抛出错误后，这里就不会执行了')
                }).catch((err)=>{
                   
                })
            //    throw new Error('Hello world');
            //    console.log('抛出错误后，这里就不会执行了')
            } catch (err) {
                // 只有try抛出错误这里才会执行
                console.error(err.message); // Hello world
            } finally {
               console.log('无论如何都会执行');
            }


    </script>

</body>

</html> -->


<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
  <div id="app">
    <el-button @click="visible = true">Button</el-button>
    <el-dialog :visible.sync="visible" title="Hello world">
      <p>Try Element</p>
    </el-dialog>
  </div>
</body>
  <!-- import Vue before Element -->
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  <script src="https://unpkg.com/vue@2/dist/vue.js"></script>
  <!-- import JavaScript -->
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: function() {
        return { visible: false }
      },
      created() {
         this.fmm()
      },
      methods: {
            fmm(){
                try {
                   axios.get('https://mock.mengxuegu.com/mock/63e3130a4b99657e298502f2/trycatch/quaqnxiandeom').then((res)=>{
                        this.$message.error(res.data.data.message)
                        //throw new Error('Hello world');
                    })
                    } catch (err) {
                        // 只有try抛出错误这里才会执行
                        console.error('错误了'); // Hello world
                    } 
            }
      }

    })
  </script>
</html>